package com.tanhua.autoconfig;

import com.tanhua.properties.AipFaceProperties;
import com.tanhua.properties.OssProperties;
import com.tanhua.properties.SmsProperties;
import com.tanhua.template.AipFaceTemplate;
import com.tanhua.template.OssTemplate;
import com.tanhua.template.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//声明当前是一个配置类
@Configuration
//使 @ConfigurationProperties 注解的类生效。
@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class
})
public class TanhuaAutoConfiguration {

    @Bean  //发短信验证
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {

        return new SmsTemplate(smsProperties);
    }
    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties) {
        return new OssTemplate(ossProperties);
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties) {
        return new AipFaceTemplate(aipFaceProperties);
    }
    // ......
}